package com.reason.search.controller;

import com.reason.common.pojo.Result;
import com.reason.common.pojo.StatusCode;
import com.reason.search.pojo.CustomerInfo;
import com.reason.search.service.SearchService;
import com.reason.user.pojo.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author zhangHeng
 * @date 2020/7/1 19:02
 */
@Controller
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private SearchService searchService;

    @GetMapping("/customer")
    @ResponseBody
    public Map searchCustomer(@RequestParam Map<String, String> searchMap) {
        Map searchResult = searchService.search(searchMap);
        return searchResult;
    }
    @GetMapping("/searchCusById/{cusId}")
    @ResponseBody
    public Result searchById(@PathVariable("cusId") Long cusId){
        Map<String,Object> map=searchService.searchById(cusId);
        return new Result(true, StatusCode.OK,"查询成功",map);
    }

}
